package org.etom.connector.datatypes;

import org.etom.connector.service.ConnectorException;

/**
 * The connection is the entry point to Moodle server.
 */
public interface IMoodleConnection {
  
  /**
   * The method returns the URL to Moodle server.
   * For example:
   * <br>http://localhost/moodle
   * 
   * @return - the connection URL, which points to Moodle server
   */
  public String getMoodleUrl();
  
  /**
   * The method retrns the URL of the Moodle RPC server.
   * The is similar to;
   * <br>/mnet/xmlrpc/server.php
   * 
   * @return - the RPC server url
   */
  public String getRpcServerUrl();
  
  /**
   * The method returns the user name which is used for the authentication.
   * 
   * @return - the user name used for authentication
   */
  public String getUserName();
  
  /**
   * The method returns the user password which is used for the authentication.
   * 
   * @return - the user password
   */
  public String getPassword();
  
  /**
   * The method returns the Moodle user.
   * It does a real connection to the server and reads
   * the user details from there.
   * 
   * @return - the Moodle user
   * 
   * @throws ConnectorException
   *  The exception is thrown if the connection can not be established
   *  or the server returns an error.
   */
  public IMoodleUser getUser() throws ConnectorException;
  
}
